function loadcontent() {
	loadnews()
	loadbooks()
}

function loadnews() {
	$.get('api/news_get.php?TOKEN=923a475e523e503e3906e7084ca55fb6', function(data){
		let news = JSON.parse(data)['news']
		showNews(news)
	});
}

function loadbooks() {
	$.get('api/books.get.php?TOKEN=923a475e523e503e3906e7084ca55fb6', function(data){
		let books = JSON.parse(data)['books']
		showBooks(books)
	});
}

function showNews(news) {
	let div = $('#news')
	for (let i = 0; i < news.length; i++) {
		let title = $('<h1>'+news[i].title + '</h1>')
		let content = $('<h2>'+news[i].content + '</h2>')
		let date = $('<h3>'+news[i].date + '</h3>><hr>')
		
		div.append(title)
		div.append(content)
		div.append(date)
		console.log(title)
	}
		console.log(news.length)
}

function showBooks(books) {
	let div = $('#books')
	for (let i = 0; i < books.length; i++) {
		let name = $('<h2>'+books[i].name + '</h1>')
		let autor = $('<h3>Автор: '+books[i].autor + '</h2>')
		let price = $('<h2>Цена: '+books[i].price + '</h3>')
		let amount = $('<h2>Количество：'+books[i].amount + '</h2><hr>')

		div.append(name)
		div.append(autor)
		div.append(price)
		div.append(amount)
		console.log(name)
	}
		console.log(books.length)
}